package myJs.implicits

import japgolly.scalajs.react.component.Scala
import japgolly.scalajs.react.vdom.all.VdomElement
import org.scalajs.dom.{DOMList, Element, Node, NodeList}
import org.scalajs.dom.ext._

import scala.scalajs.js
import scala.scalajs.js.JSON

/**
 * Created by Administrator on 2020/1/16
 */
trait MyReactTool {

  implicit class MyComponent[T, C](component: Scala.Unmounted[Unit, T, C]) {

    def renderIntoDOM(nodes: NodeList[Element]): Unit = {
      nodes.foreach { y =>
        component.renderIntoDOM(y)
      }
    }
  }

  implicit class MyVdomElement(vdom: VdomElement) {

    def renderIntoDOM(nodes: NodeList[Element]): Unit = {
      nodes.foreach { y =>
        vdom.renderIntoDOM(y)
      }
    }
  }


}
